/*    */ package com.zimbra.cs.mailbox.alerts;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.mailbox.CalendarItem;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.ScheduledTask;
/*    */ import com.zimbra.cs.mailbox.calendar.Invite;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public abstract class CalItemReminderTaskBase
/*    */   extends ScheduledTask
/*    */ {
/*    */   static final String CAL_ITEM_ID_PROP_NAME = "calItemId";
/*    */   static final String INV_ID_PROP_NAME = "invId";
/*    */   static final String COMP_NUM_PROP_NAME = "compNum";
/*    */   static final String NEXT_INST_START_PROP_NAME = "nextInstStart";
/*    */   
/*    */   public CalendarItem call()
/*    */     throws Exception
/*    */   {
/* 43 */     if (ZimbraLog.scheduler.isDebugEnabled())
/* 44 */       ZimbraLog.scheduler.debug("Running task %s", new Object[] { this });
/* 45 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
/* 46 */     if (mbox == null) {
/* 47 */       ZimbraLog.scheduler.error("Mailbox with id %s does not exist", new Object[] { Integer.valueOf(getMailboxId()) });
/* 48 */       return null;
/*    */     }
/* 50 */     Integer calItemId = new Integer(getProperty("calItemId"));
/*    */     CalendarItem calItem;
/*    */     try {
/* 53 */       calItem = mbox.getCalendarItemById(null, calItemId.intValue());
/*    */     } catch (ServiceException e) {
/* 55 */       ZimbraLog.scheduler.warn("Calendar item with id %s does not exist", new Object[] { calItemId });
/* 56 */       return null;
/*    */     }
/* 58 */     if (calItem.inTrash()) {
/* 59 */       ZimbraLog.scheduler.debug("Calendar item with id %s is in Trash", new Object[] { calItemId });
/* 60 */       return null;
/*    */     }
/* 62 */     Integer invId = new Integer(getProperty("invId"));
/* 63 */     Integer compNum = new Integer(getProperty("compNum"));
/* 64 */     Invite invite = calItem.getInvite(invId.intValue(), compNum.intValue());
/* 65 */     if (invite == null) {
/* 66 */       ZimbraLog.scheduler.warn("Invite with id %s and comp num %s does not exist", new Object[] { invId, compNum });
/* 67 */       return null;
/*    */     }
/* 69 */     sendReminder(calItem, invite);
/* 70 */     return calItem;
/*    */   }
/*    */   
/*    */   protected abstract void sendReminder(CalendarItem paramCalendarItem, Invite paramInvite)
/*    */     throws Exception;
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/mailbox/alerts/CalItemReminderTaskBase.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */